from Models import *
# 存放全局函数文件

appconfig = json.load(open(file=pathlib.Path("config").joinpath("AppConfig.json"), encoding="utf-8",mode="r"))
print_flag = appconfig.get("appstartmode")

def FindQtChildObject(parent, name):
    """查找Qt父对象下的子元素对象.

    Args:
        parent (_type_): Qt 父对象
        name (_type_): 子元素名称

    Returns:
        _type_: _description_
    """
    for i in range(parent.children().__len__()):
        if parent.children()[i].objectName() == name:
            return parent.children()[i]
    return None

def cprint(args):
    if print_flag == "debug":
        print(args)
    else:
        pass